<!--
* @Description: 项目管理 - 表单
* @Author: DSY
* @Date: 2022-03-14 21:48:53
 * @LastEditors: DHL
 * @LastEditTime: 2023-01-09 17:19:06
-->
<template>
  <tw-dialog
    v-model="visible"
    :title="title"
    :loading="loading"
    width="600px"
    height="300px"
    @close="handleClose"
  >
    <el-form ref="dbFormRef" :model="dbForm" :rules="rules" label-width="90px">
      <el-form-item label="项目编码" prop="code">
        <el-input v-model="dbForm.code" clearable placeholder="请输入项目编码"></el-input>
      </el-form-item>

      <el-form-item label="项目名称" prop="name">
        <el-input v-model="dbForm.name" clearable placeholder="请输入项目名称"></el-input>
      </el-form-item>

      <el-form-item label="接入ID" prop="appId">
        <el-input v-model="dbForm.appId" clearable placeholder="请输入接入ID"></el-input>
      </el-form-item>

      <el-form-item label="接入Token" prop="appToken">
        <el-input v-model="dbForm.appToken" clearable placeholder="请输入接入Token"></el-input>
      </el-form-item>

      <el-form-item label="接入密钥" prop="appSecret" v-if="action === 'view'">
        <el-input v-model="dbForm.appSecret" clearable placeholder="请输入接入密钥"></el-input>
      </el-form-item>

      <el-form-item label="项目类型" prop="appType">
        <el-select v-model="dbForm.appType" clearable placeholder="请选择项目类型">
          <tw-dic dicKey="PROJECT_TYPE"></tw-dic>
        </el-select>
      </el-form-item>

      <el-form-item label="IP地址" prop="ipAddr">
        <el-input v-model="dbForm.ipAddr" clearable placeholder="请输入IP地址"></el-input>
      </el-form-item>

      <el-form-item label="端口号" prop="portCode">
        <el-input v-model="dbForm.portCode" clearable placeholder="请输入端口号"></el-input>
      </el-form-item>

      <el-form-item label="域名" prop="webAddr">
        <el-input v-model="dbForm.webAddr" clearable placeholder="请输入域名"></el-input>
      </el-form-item>

      <el-form-item label="顺序号" prop="proSeq">
        <el-input-number v-model="dbForm.proSeq" clearable placeholder="请输入顺序号" />
      </el-form-item>

      <el-form-item label="接入状态" prop="status">
        <el-select v-model="dbForm.status" clearable placeholder="请选择接入状态">
          <tw-dic dicKey="PROJECT_STATUS"></tw-dic>
        </el-select>
      </el-form-item>

      <el-form-item label="备注" prop="remark">
        <el-input v-model="dbForm.remark" clearable placeholder="请输入备注"></el-input>
      </el-form-item>
    </el-form>

    <template #footer>
      <el-button @click="handleReset(true)">取 消</el-button>
      <el-button v-if="action === 'add'" type="warning" @click="handleSubmit(true)">
        提交并继续
      </el-button>
      <el-button v-if="action !== 'view'" type="primary" @click="handleSubmit(false)">
        提 交
      </el-button>
    </template>
  </tw-dialog>
</template>

<script src="./useForm.ts"></script>

<style scoped lang="scss"></style>
